﻿namespace Cos.Module.Blog
{
    using System.Collections.Generic;
    using Core.Model.Blog;
    using Core.Model.Common;
    using Exceptions;

    /// <summary>
    /// The interface signature for the 'BlogService' object.
    /// </summary>
    public interface IBlogService
    {
        /// <summary>
        /// Gets the list of tags.
        /// </summary>
        IEnumerable<Tag> GetTags { get; }

        /// <summary>
        /// Gets the blog from blog id.
        /// </summary>
        /// <param name="blogId">blogId the id of the blog.</param>
        /// <param name="culture">The culture.</param>
        /// <returns>The blog from blog id.</returns>
        /// <exception cref="BlogNotFoundException">If the blog could not be found or converted.</exception>
        Core.Model.Blog.Blog GetBlog(int blogId, Culture culture);

        /// <summary>
        /// Used to retrieve the number of articles of a blog
        /// </summary>
        /// <param name="blogId">blogId id of the blog.</param>
        /// <returns>The number of articles</returns>
        int GetNumberOfArticles(int blogId);

        /// <summary>
        /// Gets the article by id.
        /// </summary>
        /// <param name="articleId">id of the article.</param>
        /// <param name="culture">The culture.</param>
        /// <returns>The article.</returns>
        /// <exception cref="ArticleNotFoundException">The article could not be found or converted</exception>
        Article GetArticle(int articleId, Culture culture);

        /// <summary>
        /// Gets the articles associated to a blog.
        /// </summary>
        /// <param name="blogId">the id of the blog.</param>
        /// <param name="culture">The culture.</param>
        /// <returns>The articles</returns>
        /// <exception cref="ArticleNotFoundException">the article could not be found or converted</exception>
        IEnumerable<Article> GetArticles(int blogId, Culture culture);

        /// <summary>
        /// Gets the X latest articles associated to a blog.
        /// </summary>
        /// <param name="blogId">the id of the blog.</param>
        /// <param name="culture">The culture.</param>
        /// <param name="maxResult">maximum articles to retrieve.</param>
        /// <param name="toDate">return maxResult articles until the toDate is reached.</param>
        /// <returns>The articles</returns>
        /// <exception cref="ArticleNotFoundException">the article could not be found or converted</exception>
        IEnumerable<Article> GetArticles(int blogId, Culture culture, int maxResult, long toDate);

        /// <summary>
        /// Gets the articles associated to a blog.
        /// </summary>
        /// <param name="blogId">the id of the blog.</param>
        /// <param name="culture">The culture.</param>
        /// <param name="firstResult">tell to start at the firstResult id.</param>
        /// <param name="maxResult">maximum articles to retrieve.</param>
        /// <param name="toDate">maxResult articles until the toDate is reached.</param>
        /// <returns>The articles</returns>
        /// <exception cref="ArticleNotFoundException">the article could not be found or converted</exception>
        IEnumerable<Article> GetArticles(int blogId, Culture culture, int firstResult, int maxResult, long toDate);

        /// <summary>
        /// Updates the article.
        /// </summary>
        /// <param name="article">the article to save.</param>
        void UpdateArticle(Article article);

        /// <summary>
        /// Submit an article.
        /// </summary>
        /// <param name="blogId">the id of the blog.</param>
        /// <param name="culture">The culture.</param>
        /// <param name="article">the article to savee.</param>
        void SubmitArticle(int blogId, Culture culture, Article article);

        /// <summary>
        /// Deletes the article.
        /// </summary>
        /// <param name="articleId">id of the article.</param>
        void DeleteArticle(int articleId);

        /// <summary>
        /// Submits the comment.
        /// </summary>
        /// <param name="culture">The culture.</param>
        /// <param name="comment">The comment to save.</param>
        void SubmitComment(Culture culture, Comment comment);

        /// <summary>
        /// Deletes the comment.
        /// </summary>
        /// <param name="commentId">The comment id.</param>
        void DeleteComment(int commentId);
    }
}